using IQIGame.Onigao.Framework;
using IQIGame.Onigao.Game;

namespace IQIGame.Onigao.GamePlay
{
    public class UIN_BattleStatInfo : UIBaseNode
    {
        #region Template Generate,don't modify
        protected partial class UIB_UIBattleStatItem
        {
            #region ObjectBinding Generate
            public IQIGame.Onigao.Framework.ExImage imageBar { protected set; get; }
            public IQIGame.Onigao.Framework.ExText text_att { protected set; get; }
            public IQIGame.Onigao.Framework.ExText rate { protected set; get; }
            public virtual void InitBinding(ObjectBinding __binding)
            {
                __binding.TryGetVariableValue<IQIGame.Onigao.Framework.ExImage>("imageBar", out var __tbv0);
                this.imageBar = __tbv0;
                __binding.TryGetVariableValue<IQIGame.Onigao.Framework.ExText>("text_att", out var __tbv1);
                this.text_att = __tbv1;
                __binding.TryGetVariableValue<IQIGame.Onigao.Framework.ExText>("rate", out var __tbv2);
                this.rate = __tbv2;
            }
            #endregion ObjectBinding Generate 
        }
        #endregion Template Generate,don't modify


        protected UIB_UIBattleStatItem ui { get; set; }

        protected override void BeforeInit()
        {
            ui = new UIB_UIBattleStatItem();
            ui.InitBinding(this.csObjBind);
        }

        protected override void OnInit()
        {

        }

        protected override void OnShow()
        {

        }

        protected override void OnHide()
        {

        }

        public void SetValue(float rate, int value)
        {
            this.ui.imageBar.fillAmount = rate;
            this.ui.text_att.text = value.ToString();
            this.ui.rate.text = rate.ToString("P");
        }


        protected override void OnDispose()
        {

        }
    }
}